package com.nbjtjc.safe.api.safe;

import com.nbjtjc.common.validator.ValidatorUtils;
import com.nbjtjc.safe.bean.Result;
import com.nbjtjc.safe.model.safe.SafeDangerInspectPlan;
import com.nbjtjc.safe.service.safe.SafeDangerInspectPlanServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/safe/plan")
@CrossOrigin("*")
public class SafeDangerInspectPlanController {

    @Autowired
    private SafeDangerInspectPlanServiceImpl safeDangerInspectPlanService;


    @PostMapping(value = "/add")
    public Result add(@RequestBody SafeDangerInspectPlan safeDangerInspectPlan){
        ValidatorUtils.validateEntity(safeDangerInspectPlan);
        return safeDangerInspectPlanService.add(safeDangerInspectPlan);
    }
    @PostMapping(value = "/addWithTaskPlan")
    public Result addWithTaskPlan(@RequestBody SafeDangerInspectPlan safeDangerInspectPlan){
        ValidatorUtils.validateEntity(safeDangerInspectPlan);
        return safeDangerInspectPlanService.addWithTaskPlan(safeDangerInspectPlan);
    }


    @PostMapping(value = "/delete")
    public Result delete(@RequestBody SafeDangerInspectPlan safeDangerInspectPlan){
        ValidatorUtils.validateEntity(safeDangerInspectPlan);
        return safeDangerInspectPlanService.delete(safeDangerInspectPlan);
    }
    @PostMapping(value = "/update")
    public Result update(@RequestBody SafeDangerInspectPlan safeDangerInspectPlan){
        ValidatorUtils.validateEntity(safeDangerInspectPlan);
        return safeDangerInspectPlanService.update(safeDangerInspectPlan);
    }

    @PostMapping(value = "/search")
    public Result search(@RequestBody SafeDangerInspectPlan safeDangerInspectPlan){
        ValidatorUtils.validateEntity(safeDangerInspectPlan);
        return safeDangerInspectPlanService.search(safeDangerInspectPlan);
    }


    @PostMapping(value = "/info")
    public Result info(@RequestBody SafeDangerInspectPlan safeDangerInspectPlan){

        return safeDangerInspectPlanService.info(safeDangerInspectPlan);
    }

}
